<div class="ibox">
<div class="ibox-content">
<form class="form-horizontal"  id="editForm" action="${cxt!}/platform/task/update" method="POST" >

		   <input type="hidden" id="gtaskid" name="gTask.id" value="${gTask.id!}" >
			
           <div class="form-group">
         <label for="namebasic" class="col-md-2 control-label">${_res["gtask.taskname"]}<span class="fontColorRed">&nbsp;*</span></label>
         <div class="col-md-3">
          	<input type="text" class="form-control" name="gTask.taskname"  value="${gTask.taskname!}" placeholder="${_res["gtask.taskname"]}"  disabled="true" required aria-required="true">
         </div>
         <label class="col-md-2 control-label">${_res["gtask.active"]}<span class="fontColorRed">&nbsp;*</span></label>
            <div class="col-md-3">
               <#dict type="select"  class="form-control" name="gTask.active"  value="${gTask.active!}" dictCode="COMMON_STATUS" required="true"/>
            </div>
      </div>

      <div class="form-group">
         <label class="col-md-2 control-label">${_res["gtask.command"]}<span class="fontColorRed">&nbsp;*</span></label>
            <div class="col-md-3">
               <#dict type="select"  class="form-control" name="gTask.command" value="${gTask.command!}" dictCode="TASK_COMMAND" required="true"/>
            </div>
            <label class="col-md-2 control-label">${_res["gtask.period"]}<span class="fontColorRed">&nbsp;*</span></label>
            <div class="col-md-3">
               <#dict type="select"  class="form-control" id="taskPeriod" name="gTask.period" value="${gTask.period!}" dictCode="TASK_PERIOD" required="true"/>
            </div>
      </div>
      
      <div class="form-group">
            <label class="col-md-2 control-label">${_res["gtask.arguments"]}</label>
            <div class="col-md-8">
               <input type="text" id="gtask_arguments" class="form-control" name="gTask.arguments" value="${gTask.arguments!}" placeholder="${_res["gtask.arguments"]}" />
            </div>
      </div>
      
      <div id="period-parameter">
      <div class="form-group">
      		 <label for="namebasic" class="col-md-2 control-label">${_res["gtask.ss"]}<span class="fontColorRed">&nbsp;*</span></label>
         <div class="col-md-3">
          	<input type="text" id="gtask_ss" class="form-control" name="gTask.ss" value="${gTask.ss!}" placeholder="${_res["gtask.ss"]}"  required aria-required="true">
         </div>
      		 <label for="namebasic" class="col-md-2 control-label">${_res["gtask.mi"]}<span class="fontColorRed">&nbsp;*</span></label>
         <div class="col-md-3">
          	<input type="text" id="gtask_mi" class="form-control" name="gTask.mi" value="${gTask.mi!}" placeholder="${_res["gtask.mi"]}"  required aria-required="true">
         </div>
      </div>
      
      <div class="form-group">
      		<label for="namebasic" class="col-md-2 control-label">${_res["gtask.hh"]}<span class="fontColorRed">&nbsp;*</span></label>
         <div class="col-md-3">
          	<input type="text" id="gtask_hh" class="form-control" name="gTask.hh" value="${gTask.hh!}" placeholder="${_res["gtask.hh"]}"  required aria-required="true">
         </div>
      		<label for="namebasic" class="col-md-2 control-label">${_res["gtask.dd"]}<span class="fontColorRed">&nbsp;*</span></label>
        <div class="col-md-3">
          	<input type="text" id="gtask_dd" class="form-control" name="gTask.dd" value="${gTask.dd!}" placeholder="${_res["gtask.dd"]}"  required aria-required="true">
        </div>
      </div>
      
      <div class="form-group">
      	   <label for="namebasic" class="col-md-2 control-label">${_res["gtask.wk"]}<span class="fontColorRed">&nbsp;*</span></label>
           <div class="col-md-8">
          	<#dict type="checkbox" name="gTask.wk" value="${gTask.wk!}" dictCode="COMMON_WEEKS" required="true"/>
           </div>
      </div>
      
      <div class="form-group">
      		<label for="namebasic" class="col-md-2 control-label">${_res["gtask.mm"]}<span class="fontColorRed">&nbsp;*</span></label>
         <div class="col-md-8">
          	<#dict type="checkbox" name="gTask.mm" value="${gTask.mm!}" dictCode="COMMON_MONTHS" required="true"/>
         </div>
      </div>
      </div>
      
      <div class="form-group">
      		<label for="namebasic" class="col-md-2 control-label">${_res["gtask.startdtm"]}<span class="fontColorRed">&nbsp;*</span></label>
        <div class="col-md-3">
          	<input type="text" class="laydate-icon form-control layer-date" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" name="gTask.startdtm" value="${gTask.startdtm!}" placeholder="${_res["gtask.startdtm"]}"  required aria-required="true">
        </div>
        <label for="namebasic" class="col-md-2 control-label">${_res["gtask.enddtm"]}<span class="fontColorRed">&nbsp;*</span></label>
        <div class="col-md-3">
          	<input type="text" class="laydate-icon form-control layer-date" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" name="gTask.enddtm" value="${gTask.enddtm!}" placeholder="${_res["gtask.enddtm"]}"  required aria-required="true">
        </div>
      </div>
      
      <div class="form-group">
         <label for="namebasic" class="col-md-2 control-label">${_res["gtask.emailreminder"]}</label>
         <div class="col-md-3">
          	<input type="email" class="form-control" name="gTask.emailreminder" value="${gTask.emailreminder!}" placeholder="${_res["gtask.emailreminder"]}" />
         </div>
         
      </div>
      
      <div class="hr-line-dashed"></div>
       
       <div class="form-group">
         <div class="col-md-10 col-md-offset-2">
           <button type="button" class="btn btn-warning" onClick="ajaxContent('/platform/task/list');">${_res["system.return"]}</button>
           <button type="submit" class="btn btn-primary" >${_res["system.save"]}</button>
         </div>
       </div>
 </form>
 </div></div>
 <#submit  formId="editForm"  divId="content" />
 <#nav />
 
 <script type="text/javascript">
	(function pageInit(){
		//根据用户选择的执行方式，动态决定是否显示cron参数控件
		if($("#taskPeriod").children('option:selected').val()==0){
			$("#period-parameter").css("display","none");
			$("#gtask_ss").removeAttr("required");
			$("#gtask_mi").removeAttr("required");
			$("#gtask_hh").removeAttr("required");
			$("#gtask_dd").removeAttr("required");
			
			$("#gtask_ss").removeAttr("aria-required");
			$("#gtask_mi").removeAttr("aria-required");
			$("#gtask_hh").removeAttr("aria-required");
			$("#gtask_dd").removeAttr("aria-required");
		}else{
			$("#period-parameter").css("display","block");
			$("#gtask_ss").attr("required","true");
			$("#gtask_mi").attr("required","true");
			$("#gtask_hh").attr("required","true");
			$("#gtask_dd").attr("required","true");
			
			$("#gtask_ss").attr("aria-required","true");
			$("#gtask_mi").attr("aria-required","true");
			$("#gtask_hh").attr("aria-required","true");
			$("#gtask_dd").attr("aria-required","true");
		}
		
		$("#taskPeriod").change(function(){  
			var selVal=$(this).children('option:selected').val();//这就是selected的值
			if(selVal==0){
				$("#period-parameter").css("display","none");
				$("#gtask_ss").removeAttr("required");
				$("#gtask_mi").removeAttr("required");
				$("#gtask_hh").removeAttr("required");
				$("#gtask_dd").removeAttr("required");
				
				$("#gtask_ss").removeAttr("aria-required");
				$("#gtask_mi").removeAttr("aria-required");
				$("#gtask_hh").removeAttr("aria-required");
				$("#gtask_dd").removeAttr("aria-required");
			}else{
				$("#period-parameter").css("display","block");
				$("#gtask_ss").attr("required","true");
				$("#gtask_mi").attr("required","true");
				$("#gtask_hh").attr("required","true");
				$("#gtask_dd").attr("required","true");
				
				$("#gtask_ss").attr("aria-required","true");
				$("#gtask_mi").attr("aria-required","true");
				$("#gtask_hh").attr("aria-required","true");
				$("#gtask_dd").attr("aria-required","true");
			}
		});
	})();

</script>